package servlet;

import pojo.ClassTable;
import service.ClasstableService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

/**
 *2022.3.16测试完成，由李红玉编写
 * 点击按钮失效
 */
@WebServlet(name = "ClassDel_UpdateServlet", value = "/ClassDel_UpdateServlet")
public class ClassDel_UpdateServlet extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }

    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
        resp.setContentType("text/html; charset=utf-8");
        PrintWriter out=resp.getWriter();
        ClasstableService classtableService=new ClasstableService();

        //保存结果变量
        int save=0;
        ClassTable classTable=new ClassTable();
        classTable.setInvalid(1);
        classTable.setId(2);
        try {
            save=classtableService.del_Update(classTable);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

        out.println(save);
    }
}
